<?php
defined('IN_TS') or die('Access Denied.');

$userid = intval($_GET['userid']);

$strUser = $DB->once_fetch_assoc("select * from ".dbprefix."app_user_info where userid='".$userid."'");

if($strUser == '') header("Location: index.php");

//头像
if($strUser['face'] != ''){
	$menu = substr($userid,0,1);
	$strUser['bigface'] = 'data/uploadfile/user/'.$menu.'/'.$userid.'/'.$userid.'_98.jpg';
}else{
	$strUser['bigface'] = 'data/uploadfile/user/default/n_default.gif';
	$strUser['face']	= 'data/uploadfile/user/default/noavatar.gif';
}
//城市 
if($strUser['cityid'] != '0'){
	$strUser['city'] = $DB->once_fetch_assoc("select * from ".dbprefix."app_location_city where cityid='".$strUser['cityid']."'");
}

//跟随他的用户
$followedUsers = $DB->fetch_all_assoc("select userid from ".dbprefix."app_user_follow where userid_follow='$userid' order by addtime limit 12");

if(is_array($followedUsers)){
	foreach($followedUsers as $item){
		$arrFollowedUser[] =  getUserData($item['userid']);
	}
}

$title =  '谁在跟随'.$strUser['username'];
include TmooTemplate('followed');

//通过uid获取用户数据
function getUserData($userid){

	global $DB;
	$userData = $DB->once_fetch_assoc("select * from ".dbprefix."app_user_info where userid='$userid'");
	
	//同城
	if($userData['cityid'] != '0'){
		$userData['city'] = $DB->once_fetch_assoc("select * from ".dbprefix."app_location_city where cityid='".$userData['cityid']."'");
	}else{
		$userData['city']['cityname']='火星';
	}
	
	//头像
	if($userData['face'] == ''){
		$userData['face']	= 'data/uploadfile/user/default/noavatar.gif';
	}
	
	return $userData;
	
}